package severlet;

import dao.FeeDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "AdminDelFeeInfoServlet", value = "/AdminDelFeeInfoServlet")
public class AdminDelFeeInfoServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setCharacterEncoding("utf-8"); // 设置编码格式
        request.setCharacterEncoding("utf-8");

        String months = request.getParameter("months");
        String dormitoryid = request.getParameter("dormitoryid");

        FeeDao feeDao=new FeeDao();
        feeDao.delInfoByMonthAndDormitoryid(months,dormitoryid);

        request.getRequestDispatcher("/AdminFeeServlet").forward(request,response);
    }
}
